package cn.mysdp.biz.domain;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * InterfaceName: SdpProjectForShellExample
 * @Description:
 * @Author: SDP
 * @Date: 2025-02-06
 * @Version: 1.0
 * Table: sdp_project
 * Comment:
 * 
 */
public class SdpProjectForShellExample extends BaseExample {
    protected SdpProjectForShell simple = new SdpProjectForShell();

    protected List<Criteria> oredCriteria = new ArrayList<>();

    public void setSimple(SdpProjectForShell simple) {
        this.simple = simple;
    }

    public SdpProjectForShell getSimple() {
        return simple;
    }

    public List<Criteria> getOredCriteria() {
        return oredCriteria;
    }

    public void or(Criteria criteria) {
        oredCriteria.add(criteria);
    }

    public Criteria or() {
        Criteria criteria = createCriteriaInternal();
        oredCriteria.add(criteria);
        return criteria;
    }

    public Criteria createCriteria() {
        Criteria criteria = createCriteriaInternal();
        if (oredCriteria.size() == 0) {
            oredCriteria.add(criteria);
        }
        return criteria;
    }

    protected Criteria createCriteriaInternal() {
        Criteria criteria = new Criteria();
        return criteria;
    }

    public void clear() {
        oredCriteria.clear();
        orderByClause = null;
        distinct = false;
    }

    public static SdpProjectForShellExample createExample(SdpProjectForShell request) throws Exception {
        return createExample(request, null);
    }

    public static SdpProjectForShellExample createExample(SdpProjectForShell request, JSONObject options) throws Exception {
        SdpProjectForShellExample example = new SdpProjectForShellExample();
        example.setSimple(request);
        SdpProjectForShellExample.Criteria criteria = example.createCriteria();

        example.fixExample(SdpProjectForShell.class, CriteriaString.class, criteria, options);

        if (options != null) {
            String orderBy = "";
            if (options.containsKey("order_by")) {
                orderBy = setCriteriaOrderBy(options.getJSONArray("order_by"), example);
                if (orderBy.length() > 0) {
                    example.setOrderByClause(orderBy);
                }
            }
        }

        return example;
    }

    private static String setCriteriaOrderBy(JSONArray jsonArray, SdpProjectForShellExample example) throws Exception {
        List<Object> request = Criterion.toList(jsonArray, CriteriaString.class);
        StringBuilder sb = new StringBuilder();
        int count = 0;
        for(int i = 0; i < request.size(); i++) {
            Object criteriaOrderByObj  = request.get(i);
            CriteriaString criteriaOrderBy = (CriteriaString)criteriaOrderByObj;
            int subCount = 0;

            subCount += appendCriteriaOrderByItem(sb, "cmd", criteriaOrderBy.getCmd());
            subCount += appendCriteriaOrderByItem(sb, "`stdin`", criteriaOrderBy.getStdin());
            subCount += appendCriteriaOrderByItem(sb, "param", criteriaOrderBy.getParam());
            subCount += appendCriteriaOrderByItem(sb, "`result`", criteriaOrderBy.getResult());
            if (subCount > 1) {
                throw new Exception("order by数组元素对象属性多于1个(SdpProjectForShellExample):"+count+","+JSON.toJSONString(jsonArray.get(i)));
            }
            if (subCount == 0 && !"{}".equals(JSON.toJSONString(jsonArray.get(i)))) {
                throw new Exception("存在非法order by 字段(SdpProjectForShellExample):"+count+","+JSON.toJSONString(jsonArray.get(i)));
            }
            count++;
        }
        if (sb.length() == 0) {
            appendCriteriaOrderByItem(sb, "1", "");
        }

        return sb.toString();
    }

    protected abstract static class GeneratedCriteria {
        protected List<Criterion> criteria;

        protected GeneratedCriteria() {
            super();
            criteria = new ArrayList<>();
        }

        public boolean isValid() {
            return criteria.size() > 0;
        }

        public List<Criterion> getAllCriteria() {
            return criteria;
        }

        public List<Criterion> getCriteria() {
            return criteria;
        }

        protected void addCriterion(String condition) {
            if (condition == null) {
                throw new RuntimeException("Value for condition cannot be null");
            }
            criteria.add(new Criterion(condition));
        }

        protected void addCriterion(String condition, Object value, String property) {
            if (value == null) {
                throw new RuntimeException("Value for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value));
        }

        protected void addCriterion(String condition, Object value1, Object value2, String property) {
            if (value1 == null || value2 == null) {
                throw new RuntimeException("Between values for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value1, value2));
        }

        public Criteria andCmdIsNull() {
            addCriterion("cmd is null");
            return (Criteria) this;
        }

        public Criteria andCmdIsNotNull() {
            addCriterion("cmd is not null");
            return (Criteria) this;
        }

        public Criteria andCmdEqualTo(String value) {
            addCriterion("cmd =", value, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdNotEqualTo(String value) {
            addCriterion("cmd <>", value, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdGreaterThan(String value) {
            addCriterion("cmd >", value, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdGreaterThanOrEqualTo(String value) {
            addCriterion("cmd >=", value, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdLessThan(String value) {
            addCriterion("cmd <", value, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdLessThanOrEqualTo(String value) {
            addCriterion("cmd <=", value, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdRegexp(String value) {
            addCriterion("cmd regexp", value, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdLike(String value) {
            addCriterion("cmd like", value, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdNotLike(String value) {
            addCriterion("cmd not like", value, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdIn(List<String> values) {
            addCriterion("cmd in", values, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdNotIn(List<String> values) {
            addCriterion("cmd not in", values, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdBetween(String value1, String value2) {
            addCriterion("cmd between", value1, value2, "cmd");
            return (Criteria) this;
        }

        public Criteria andCmdNotBetween(String value1, String value2) {
            addCriterion("cmd not between", value1, value2, "cmd");
            return (Criteria) this;
        }

        public Criteria andStdinIsNull() {
            addCriterion("`stdin` is null");
            return (Criteria) this;
        }

        public Criteria andStdinIsNotNull() {
            addCriterion("`stdin` is not null");
            return (Criteria) this;
        }

        public Criteria andStdinEqualTo(String value) {
            addCriterion("`stdin` =", value, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinNotEqualTo(String value) {
            addCriterion("`stdin` <>", value, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinGreaterThan(String value) {
            addCriterion("`stdin` >", value, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinGreaterThanOrEqualTo(String value) {
            addCriterion("`stdin` >=", value, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinLessThan(String value) {
            addCriterion("`stdin` <", value, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinLessThanOrEqualTo(String value) {
            addCriterion("`stdin` <=", value, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinRegexp(String value) {
            addCriterion("`stdin` regexp", value, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinLike(String value) {
            addCriterion("`stdin` like", value, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinNotLike(String value) {
            addCriterion("`stdin` not like", value, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinIn(List<String> values) {
            addCriterion("`stdin` in", values, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinNotIn(List<String> values) {
            addCriterion("`stdin` not in", values, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinBetween(String value1, String value2) {
            addCriterion("`stdin` between", value1, value2, "stdin");
            return (Criteria) this;
        }

        public Criteria andStdinNotBetween(String value1, String value2) {
            addCriterion("`stdin` not between", value1, value2, "stdin");
            return (Criteria) this;
        }

        public Criteria andParamIsNull() {
            addCriterion("param is null");
            return (Criteria) this;
        }

        public Criteria andParamIsNotNull() {
            addCriterion("param is not null");
            return (Criteria) this;
        }

        public Criteria andParamEqualTo(String value) {
            addCriterion("param =", value, "param");
            return (Criteria) this;
        }

        public Criteria andParamNotEqualTo(String value) {
            addCriterion("param <>", value, "param");
            return (Criteria) this;
        }

        public Criteria andParamGreaterThan(String value) {
            addCriterion("param >", value, "param");
            return (Criteria) this;
        }

        public Criteria andParamGreaterThanOrEqualTo(String value) {
            addCriterion("param >=", value, "param");
            return (Criteria) this;
        }

        public Criteria andParamLessThan(String value) {
            addCriterion("param <", value, "param");
            return (Criteria) this;
        }

        public Criteria andParamLessThanOrEqualTo(String value) {
            addCriterion("param <=", value, "param");
            return (Criteria) this;
        }

        public Criteria andParamRegexp(String value) {
            addCriterion("param regexp", value, "param");
            return (Criteria) this;
        }

        public Criteria andParamLike(String value) {
            addCriterion("param like", value, "param");
            return (Criteria) this;
        }

        public Criteria andParamNotLike(String value) {
            addCriterion("param not like", value, "param");
            return (Criteria) this;
        }

        public Criteria andParamIn(List<String> values) {
            addCriterion("param in", values, "param");
            return (Criteria) this;
        }

        public Criteria andParamNotIn(List<String> values) {
            addCriterion("param not in", values, "param");
            return (Criteria) this;
        }

        public Criteria andParamBetween(String value1, String value2) {
            addCriterion("param between", value1, value2, "param");
            return (Criteria) this;
        }

        public Criteria andParamNotBetween(String value1, String value2) {
            addCriterion("param not between", value1, value2, "param");
            return (Criteria) this;
        }

        public Criteria andResultIsNull() {
            addCriterion("`result` is null");
            return (Criteria) this;
        }

        public Criteria andResultIsNotNull() {
            addCriterion("`result` is not null");
            return (Criteria) this;
        }

        public Criteria andResultEqualTo(String value) {
            addCriterion("`result` =", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultNotEqualTo(String value) {
            addCriterion("`result` <>", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultGreaterThan(String value) {
            addCriterion("`result` >", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultGreaterThanOrEqualTo(String value) {
            addCriterion("`result` >=", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultLessThan(String value) {
            addCriterion("`result` <", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultLessThanOrEqualTo(String value) {
            addCriterion("`result` <=", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultRegexp(String value) {
            addCriterion("`result` regexp", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultLike(String value) {
            addCriterion("`result` like", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultNotLike(String value) {
            addCriterion("`result` not like", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultIn(List<String> values) {
            addCriterion("`result` in", values, "result");
            return (Criteria) this;
        }

        public Criteria andResultNotIn(List<String> values) {
            addCriterion("`result` not in", values, "result");
            return (Criteria) this;
        }

        public Criteria andResultBetween(String value1, String value2) {
            addCriterion("`result` between", value1, value2, "result");
            return (Criteria) this;
        }

        public Criteria andResultNotBetween(String value1, String value2) {
            addCriterion("`result` not between", value1, value2, "result");
            return (Criteria) this;
        }

    }

    public static class CriteriaString {
        @JsonProperty("cmd")
        @JSONField(name = "cmd")
        private String cmd;

        public String getCmd() {
            return cmd;
        }
        
        public void setCmd(String _v) {
            cmd = _v;
        }

        @JsonProperty("stdin")
        @JSONField(name = "stdin")
        private String stdin;

        public String getStdin() {
            return stdin;
        }
        
        public void setStdin(String _v) {
            stdin = _v;
        }

        @JsonProperty("param")
        @JSONField(name = "param")
        private String param;

        public String getParam() {
            return param;
        }
        
        public void setParam(String _v) {
            param = _v;
        }

        @JsonProperty("result")
        @JSONField(name = "result")
        private String result;

        public String getResult() {
            return result;
        }
        
        public void setResult(String _v) {
            result = _v;
        }

    }

    public static class Criteria extends GeneratedCriteria {
        protected Criteria() {
            super();
        }
    }
}
